package com.hwadee.ems.domain.vo;

import java.math.BigDecimal;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

import com.fasterxml.jackson.annotation.JsonIgnore;

import com.hwadee.ems.enums.CourseCategory;
import com.hwadee.ems.enums.SelectionMethod;
import com.hwadee.ems.enums.AssessmentMethod;
import com.hwadee.ems.service.ISemesterService;
import com.hwadee.ems.service.impl.SemesterServiceImpl;
import com.hwadee.ems.domain.po.Course;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class CourseVO {

    @JsonIgnore
    private ISemesterService semesterService = SemesterServiceImpl.getInstance();

    public CourseVO(Course course) {
        this.id = course.getId();
        this.name = course.getName();
        this.semesterId = course.getSemesterId();
        this.semester = semesterService.getById(this.semesterId).getName();
        this.credits = course.getCredits();
        this.assessmentMethod = course.getAssessmentMethod();
        this.startWeek = course.getStartWeek();
        this.endWeek = course.getEndWeek();
        this.weeks = startWeek + "-" + endWeek;
        this.totalHours = course.getTotalHours();
        this.category = course.getCategory();
        this.selectionMethod = course.getSelectionMethod();
    }

    /**
     * 课程编号
     */
    private Long id;

    /**
     * 课程名称
     */
    private String name;

    /**
     * 开课学期编号 references semester(id) for (name)
     */
    private Long semesterId;

    /**
     * 开课学期
     */
    private String semester;

    /**
     * 学分
     */
    private BigDecimal credits;

    /**
     * 考核方式，0代表考试，1代表考查，2代表其他
     */
    private AssessmentMethod assessmentMethod;

    /**
     * 上课开始周次
     */
    private Integer startWeek;

    /**
     * 上课结束周次
     */
    private Integer endWeek;

    /**
     * 上课周次
     */
    private String weeks;

    /**
     * 总学时
     */
    private Integer totalHours;

    /**
     * 课程类别，0代表通识必修，1代表通识选修，2专业基础，3代表专业核心，4代表专业选修，5代表实践教学，6代表其他
     */
    private CourseCategory category;

    /**
     * 选课方式，0代表必修，1代表可选，2代表通选，3代表其他
     */
    private SelectionMethod selectionMethod;

}
